package com.bbzn.device.client.service.impl;

import com.bbzn.device.client.dao.iswitch.SwitchMapper;
import org.apache.commons.collections4.CollectionUtils;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;

import com.bbzn.device.client.dataobject.Switch;
import com.bbzn.device.client.service.SwitchService;

@Service
public class SwitchServiceImpl implements SwitchService {

    @Resource
    private SwitchMapper switchMapper;

    @Override
    public int deleteByPrimaryKey(Long id) {
        return switchMapper.deleteByPrimaryKey(id);
    }

    @Override
    public int insert(Switch record) {
        return switchMapper.insert(record);
    }

    @Override
    public int insertOrUpdate(Switch record) {
        return switchMapper.insertOrUpdate(record);
    }

    @Override
    public int insertOrUpdateSelective(Switch record) {
        return switchMapper.insertOrUpdateSelective(record);
    }

    @Override
    public int insertSelective(Switch record) {
        return switchMapper.insertSelective(record);
    }

    @Override
    public Switch selectByPrimaryKey(Long id) {
        return switchMapper.selectByPrimaryKey(id);
    }

    @Override
    public int updateByPrimaryKeySelective(Switch record) {
        return switchMapper.updateByPrimaryKeySelective(record);
    }

    @Override
    public int updateByPrimaryKey(Switch record) {
        return switchMapper.updateByPrimaryKey(record);
    }

    @Override
    public int updateBatch(List<Switch> list) {
        return switchMapper.updateBatch(list);
    }

    @Override
    public int batchInsert(List<Switch> list) {
        return switchMapper.batchInsert(list);
    }


    @Override
    public List<Boolean> checkSwitchByTemp(Switch record) {
        List<Switch> switches = switchMapper.findByAll(record);
        boolean totalFlag = true;
        boolean tempFlag = true;
        boolean mailFlag = true;
        boolean smsFlag = true;
        List<Boolean> booleanList = new ArrayList<>();
        if (CollectionUtils.isNotEmpty(switches)) {
            Switch need = switches.get(0);
            // 总开关  0：开启 /1：关闭
            Integer totalOpen = need.getTotalOpen();
            if (totalOpen != null && totalOpen == 1) {
                totalFlag = false;
            }
            // 体温开关  0：开启 /1：关闭
            Integer tempOpen = need.getTempOpen();
            if (tempOpen != null && tempOpen == 1 || !totalFlag) {
                tempFlag = false;
            }
            // 邮箱开关  0：开启 /1：关闭
            Integer mailOpen = need.getMailOpen();
            if (mailOpen != null && mailOpen == 1 || !totalFlag) {
                mailFlag = false;
            }
            // 短信开关  0：开启 /1：关闭
            Integer smsOpen = need.getSmsOpen();
            if (smsOpen != null && smsOpen == 1 || !totalFlag) {
                smsFlag = false;
            }
        }
        booleanList.add(tempFlag);
        booleanList.add(mailFlag);
        booleanList.add(smsFlag);
        return booleanList;
    }

    @Override
    public List<Boolean> checkSwitchByRate(Switch record) {
        List<Switch> switches = switchMapper.findByAll(record);
        boolean totalFlag = true;
        boolean rateFlag = true;
        boolean mailFlag = true;
        boolean smsFlag = true;
        List<Boolean> booleanList = new ArrayList<>();
        if (CollectionUtils.isNotEmpty(switches)) {
            Switch need = switches.get(0);
            // 总开关  0：开启 /1：关闭
            Integer totalOpen = need.getTotalOpen();
            if (totalOpen != null && totalOpen == 1) {
                totalFlag = false;
            }
            // 心率开关  0：开启 /1：关闭
            Integer rateOpen = need.getRateOpen();
            if (rateOpen != null && rateOpen == 1 || !totalFlag) {
                rateFlag = false;
            }
            // 邮箱开关  0：开启 /1：关闭
            Integer mailOpen = need.getMailOpen();
            if (mailOpen != null && mailOpen == 1 || !totalFlag) {
                mailFlag = false;
            }
            // 短信开关  0：开启 /1：关闭
            Integer smsOpen = need.getSmsOpen();
            if (smsOpen != null && smsOpen == 1 || !totalFlag) {
                smsFlag = false;
            }
        }
        booleanList.add(rateFlag);
        booleanList.add(mailFlag);
        booleanList.add(smsFlag);
        return booleanList;
    }

    @Override
    public List<Boolean> checkSwitchByOxy(Switch record) {
        List<Switch> switches = switchMapper.findByAll(record);
        boolean totalFlag = true;
        boolean mailFlag = true;
        boolean smsFlag = true;
        boolean oxyFlag = true;
        List<Boolean> booleanList = new ArrayList<>();
        if (CollectionUtils.isNotEmpty(switches)) {
            Switch need = switches.get(0);
            // 总开关  0：开启 /1：关闭
            Integer totalOpen = need.getTotalOpen();
            if (totalOpen != null && totalOpen == 1) {
                totalFlag = false;
            }
            // 血氧开关  0：开启 /1：关闭
            Integer oxyOpen = need.getOxyOpen();
            if (oxyOpen != null && oxyOpen == 1 || !totalFlag) {
                oxyFlag = false;
            }
            // 邮箱开关  0：开启 /1：关闭
            Integer mailOpen = need.getMailOpen();
            if (mailOpen != null && mailOpen == 1 || !totalFlag) {
                mailFlag = false;
            }
            // 短信开关  0：开启 /1：关闭
            Integer smsOpen = need.getSmsOpen();
            if (smsOpen != null && smsOpen == 1 || !totalFlag) {
                smsFlag = false;
            }
        }
        booleanList.add(oxyFlag);
        booleanList.add(mailFlag);
        booleanList.add(smsFlag);
        return booleanList;
    }

    @Override
    public List<Boolean> checkSwitchByPower(Switch record) {
        List<Switch> switches = switchMapper.findByAll(record);
        boolean totalFlag = true;
        boolean batteryFlag = true;
        boolean mailFlag = true;
        boolean smsFlag = true;
        List<Boolean> booleanList = new ArrayList<>();
        if (CollectionUtils.isNotEmpty(switches)) {
            Switch need = switches.get(0);
            // 总开关  0：开启 /1：关闭
            Integer totalOpen = need.getTotalOpen();
            if (totalOpen != null && totalOpen == 1) {
                totalFlag = false;
            }
            // 电量开关  0：开启 /1：关闭
            Integer batteryOpen = need.getBatteryOpen();
            if (batteryOpen != null && batteryOpen == 1 || !totalFlag) {
                batteryFlag = false;
            }
            // 邮箱开关  0：开启 /1：关闭
            Integer mailOpen = need.getMailOpen();
            if (mailOpen != null && mailOpen == 1 || !totalFlag) {
                mailFlag = false;
            }
            // 短信开关  0：开启 /1：关闭
            Integer smsOpen = need.getSmsOpen();
            if (smsOpen != null && smsOpen == 1 || !totalFlag) {
                smsFlag = false;
            }
        }
        booleanList.add(batteryFlag);
        booleanList.add(mailFlag);
        booleanList.add(smsFlag);
        return booleanList;
    }

    @Override
    public List<Boolean> checkSwitchByYgObs(Switch record) {
        List<Switch> switches = switchMapper.findByAll(record);
        boolean totalFlag = true;
        boolean ygFlag = true;
        boolean mailFlag = true;
        boolean smsFlag = true;
//        boolean phoneFlag = true;
        List<Boolean> booleanList = new ArrayList<>();
        if (CollectionUtils.isNotEmpty(switches)) {
            Switch need = switches.get(0);
            // 总开关  0：开启 /1：关闭
            Integer totalOpen = need.getTotalOpen();
            if (totalOpen != null && totalOpen == 1) {
                totalFlag = false;
            }
            // 烟感开关  0：开启 /1：关闭
            Integer ygOpen = need.getBatteryOpen();
            if (ygOpen != null && ygOpen == 1 || !totalFlag) {
                ygFlag = false;
            }
            // 邮箱开关  0：开启 /1：关闭
            Integer mailOpen = need.getMailOpen();
            if (mailOpen != null && mailOpen == 1 || !totalFlag) {
                mailFlag = false;
            }
            // 短信开关  0：开启 /1：关闭
            Integer smsOpen = need.getSmsOpen();
            if (smsOpen != null && smsOpen == 1 || !totalFlag) {
                smsFlag = false;
            }
            // 语音开关  0：开启 /1：关闭
//            Integer phoneOpen = need.getPhoneOpen();
//            if (phoneOpen != null && phoneOpen == 1 || !totalFlag) {
//                phoneFlag = false;
//            }
        }
        booleanList.add(ygFlag);
        booleanList.add(mailFlag);
        booleanList.add(smsFlag);
//        booleanList.add(phoneFlag);
        return booleanList;
    }

    @Override
    public List<Boolean> checkSwitchByOffWear(Switch record, Integer state) {
        boolean totalFlag = true;
        boolean dropFlag = true;
        boolean wearFlag = true;
        boolean mailFlag = true;
        boolean smsFlag = true;
        boolean phoneFlag = true;
        boolean resultFlag = false;
        List<Boolean> booleanList = new ArrayList<>();
        List<Switch> switches = switchMapper.findByAll(record);
        if (CollectionUtils.isNotEmpty(switches)) {
            Switch need = switches.get(0);
            // 总开关  0：开启 /1：关闭
            Integer totalOpen = need.getTotalOpen();
            if (totalOpen != null && totalOpen == 1) {
                totalFlag = false;
            }
            // 脱落开关  0：开启 /1：关闭
            Integer dropOpen = need.getDropOpen();
            if (dropOpen != null && dropOpen == 1 || !totalFlag) {
                dropFlag = false;
            }
            // 佩戴开关  0：开启 /1：关闭
            Integer wearOpen = need.getWearOpen();
            if (wearOpen != null && wearOpen == 1 || !totalFlag) {
                wearFlag = false;
            }
            // 邮箱开关  0：开启 /1：关闭
            Integer mailOpen = need.getMailOpen();
            if (mailOpen != null && mailOpen == 1 || !totalFlag) {
                mailFlag = false;
            }
            // 短信开关  0：开启 /1：关闭
            Integer smsOpen = need.getSmsOpen();
            if (smsOpen != null && smsOpen == 1 || !totalFlag) {
                smsFlag = false;
            }
            // 语音开关  0：开启 /1：关闭
            Integer phoneOpen = need.getPhoneOpen();
            if (phoneOpen != null && phoneOpen == 1 || !totalFlag) {
                phoneFlag = false;
            }
        }

        if (state == 0) {  // "0":脱落  "1":佩戴
            if (totalFlag && dropFlag) {
                resultFlag = true;
            }
        } else {
            if (totalFlag && wearFlag) {
                resultFlag = true;
            }
        }
        booleanList.add(resultFlag);
        booleanList.add(mailFlag);
        booleanList.add(smsFlag);
        booleanList.add(phoneFlag);
        return booleanList;
    }

    @Override
    public List<Boolean> checkSwitchByFence(Switch record, Integer fenceCode) {
        boolean totalFlag = true;
        boolean fenceNormalOpenFlag = true;
        boolean fenceAbnormalOpenFlag = true;
        boolean mailFlag = true;
        boolean smsFlag = true;
        boolean phoneFlag = true;
        boolean resultFlag = false;
        List<Boolean> booleanList = new ArrayList<>();
        List<Switch> switches = switchMapper.findByAll(record);
        if (CollectionUtils.isNotEmpty(switches)) {
            Switch need = switches.get(0);
            // 总开关  0：开启 /1：关闭
            Integer totalOpen = need.getTotalOpen();
            if (totalOpen != null && totalOpen == 1) {
                totalFlag = false;
            }
            // 围栏恢复正常开关  0：开启 /1：关闭
            Integer fenceNormalOpen = need.getFenceNormalOpen();
            if (fenceNormalOpen != null && fenceNormalOpen == 1 || !totalFlag) {
                fenceNormalOpenFlag = false;
            }
            // 围栏异常开关  0：开启 /1：关闭
            Integer abnormalOpen = need.getFenceAbnormalOpen();
            if (abnormalOpen != null && abnormalOpen == 1 || !totalFlag) {
                fenceAbnormalOpenFlag = false;
            }
            // 邮箱开关  0：开启 /1：关闭
            Integer mailOpen = need.getMailOpen();
            if (mailOpen != null && mailOpen == 1 || !totalFlag) {
                mailFlag = false;
            }
            // 短信开关  0：开启 /1：关闭
            Integer smsOpen = need.getSmsOpen();
            if (smsOpen != null && smsOpen == 1 || !totalFlag) {
                smsFlag = false;
            }
            // 语音开关  0：开启 /1：关闭
            Integer phoneOpen = need.getPhoneOpen();
            if (phoneOpen != null && phoneOpen == 1 || !totalFlag) {
                phoneFlag = false;
            }
        }

        if (fenceCode == 1) {   // "1":恢复正常  "2":报警(触发围栏) "3":停留在围栏内
            if (totalFlag && fenceNormalOpenFlag) {
                resultFlag = true;
            }
        } else {
            if (totalFlag && fenceAbnormalOpenFlag) {
                resultFlag = true;
            }
        }
        booleanList.add(resultFlag);
        booleanList.add(mailFlag);
        booleanList.add(smsFlag);
        booleanList.add(phoneFlag);
        return booleanList;
    }

    @Override
    public List<Boolean> checkSwitchByVoltage(Switch record) {
        List<Switch> switches = switchMapper.findByAll(record);
        boolean totalFlag = true;
        boolean voltageFlag = true;
        boolean mailFlag = true;
        boolean smsFlag = true;
        boolean phoneFlag = true;
        List<Boolean> booleanList = new ArrayList<>();
        if (CollectionUtils.isNotEmpty(switches)) {
            Switch need = switches.get(0);
            // 总开关  0：开启 /1：关闭
            Integer totalOpen = need.getTotalOpen();
            if (totalOpen != null && totalOpen == 1) {
                totalFlag = false;
            }
            // 近电开关  0：开启 /1：关闭
            Integer voltageOpen = need.getVoltageOpen();
            if (voltageOpen != null && voltageOpen == 1 || !totalFlag) {
                voltageFlag = false;
            }
            // 邮箱开关  0：开启 /1：关闭
            Integer mailOpen = need.getMailOpen();
            if (mailOpen != null && mailOpen == 1 || !totalFlag) {
                mailFlag = false;
            }
            // 短信开关  0：开启 /1：关闭
            Integer smsOpen = need.getSmsOpen();
            if (smsOpen != null && smsOpen == 1 || !totalFlag) {
                smsFlag = false;
            }
            // 语音开关  0：开启 /1：关闭
            Integer phoneOpen = need.getPhoneOpen();
            if (phoneOpen != null && phoneOpen == 1 || !totalFlag) {
                phoneFlag = false;
            }
        }
        booleanList.add(voltageFlag);
        booleanList.add(mailFlag);
        booleanList.add(smsFlag);
        booleanList.add(phoneFlag);
        return booleanList;
    }

    @Override
    public List<Boolean> checkSwitchByCrash(Switch record) {
        List<Switch> switches = switchMapper.findByAll(record);
        boolean totalFlag = true;
        boolean crashFlag = true;
        boolean mailFlag = true;
        boolean smsFlag = true;
        boolean phoneFlag = true;
        List<Boolean> booleanList = new ArrayList<>();
        if (CollectionUtils.isNotEmpty(switches)) {
            Switch need = switches.get(0);
            // 总开关  0：开启 /1：关闭
            Integer totalOpen = need.getTotalOpen();
            if (totalOpen != null && totalOpen == 1) {
                totalFlag = false;
            }
            // 碰撞开关  0：开启 /1：关闭
            Integer crashOpen = need.getCrashOpen();
            if (crashOpen != null && crashOpen == 1 || !totalFlag) {
                crashFlag = false;
            }
            // 邮箱开关  0：开启 /1：关闭
            Integer mailOpen = need.getMailOpen();
            if (mailOpen != null && mailOpen == 1 || !totalFlag) {
                mailFlag = false;
            }
            // 短信开关  0：开启 /1：关闭
            Integer smsOpen = need.getSmsOpen();
            if (smsOpen != null && smsOpen == 1 || !totalFlag) {
                smsFlag = false;
            }
            // 语音开关  0：开启 /1：关闭
            Integer phoneOpen = need.getPhoneOpen();
            if (phoneOpen != null && phoneOpen == 1 || !totalFlag) {
                phoneFlag = false;
            }
        }
        booleanList.add(crashFlag);
        booleanList.add(mailFlag);
        booleanList.add(smsFlag);
        booleanList.add(phoneFlag);
        return booleanList;
    }

    @Override
    public List<Boolean> checkSwitchByFallDown(Switch record) {
        List<Switch> switches = switchMapper.findByAll(record);
        boolean totalFlag = true;
        boolean fallDownFlag = true;
        boolean mailFlag = true;
        boolean smsFlag = true;
        boolean phoneFlag = true;
        List<Boolean> booleanList = new ArrayList<>();
        if (CollectionUtils.isNotEmpty(switches)) {
            Switch need = switches.get(0);
            // 总开关  0：开启 /1：关闭
            Integer totalOpen = need.getTotalOpen();
            if (totalOpen != null && totalOpen == 1) {
                totalFlag = false;
            }
            // 跌落摔倒开关  0：开启 /1：关闭
            Integer fallDownOpen = need.getFallDownOpen();
            if (fallDownOpen != null && fallDownOpen == 1 || !totalFlag) {
                fallDownFlag = false;
            }
            // 邮箱开关  0：开启 /1：关闭
            Integer mailOpen = need.getMailOpen();
            if (mailOpen != null && mailOpen == 1 || !totalFlag) {
                mailFlag = false;
            }
            // 短信开关  0：开启 /1：关闭
            Integer smsOpen = need.getSmsOpen();
            if (smsOpen != null && smsOpen == 1 || !totalFlag) {
                smsFlag = false;
            }
            // 语音开关  0：开启 /1：关闭
            Integer phoneOpen = need.getPhoneOpen();
            if (phoneOpen != null && phoneOpen == 1 || !totalFlag) {
                phoneFlag = false;
            }
        }
        booleanList.add(fallDownFlag);
        booleanList.add(mailFlag);
        booleanList.add(smsFlag);
        booleanList.add(phoneFlag);
        return booleanList;
    }

    @Override
    public List<Boolean> checkSwitchByHarmfulGas(Switch record) {
        List<Switch> switches = switchMapper.findByAll(record);
        boolean totalFlag = true;
        boolean harmfulGasFlag = true;
        boolean mailFlag = true;
        boolean smsFlag = true;
        boolean phoneFlag = true;
        List<Boolean> booleanList = new ArrayList<>();
        if (CollectionUtils.isNotEmpty(switches)) {
            Switch need = switches.get(0);
            // 总开关  0：开启 /1：关闭
            Integer totalOpen = need.getTotalOpen();
            if (totalOpen != null && totalOpen == 1) {
                totalFlag = false;
            }
            // 有害气体开关  0：开启 /1：关闭
            Integer harmfulGasOpen = need.getHarmfulGasOpen();
            if (harmfulGasOpen != null && harmfulGasOpen == 1 || !totalFlag) {
                harmfulGasFlag = false;
            }
            // 邮箱开关  0：开启 /1：关闭
            Integer mailOpen = need.getMailOpen();
            if (mailOpen != null && mailOpen == 1 || !totalFlag) {
                mailFlag = false;
            }
            // 短信开关  0：开启 /1：关闭
            Integer smsOpen = need.getSmsOpen();
            if (smsOpen != null && smsOpen == 1 || !totalFlag) {
                smsFlag = false;
            }
            // 语音开关  0：开启 /1：关闭
            Integer phoneOpen = need.getPhoneOpen();
            if (phoneOpen != null && phoneOpen == 1 || !totalFlag) {
                phoneFlag = false;
            }
        }
        booleanList.add(harmfulGasFlag);
        booleanList.add(mailFlag);
        booleanList.add(smsFlag);
        booleanList.add(phoneFlag);
        return booleanList;
    }

    @Override
    public List<Boolean> checkSwitchBySOS(Switch record) {
        List<Switch> switches = switchMapper.findByAll(record);
        boolean totalFlag = true;
        boolean sosFlag = true;
        boolean mailFlag = true;
        boolean smsFlag = true;
        boolean phoneFlag = true;
        List<Boolean> booleanList = new ArrayList<>();
        if (CollectionUtils.isNotEmpty(switches)) {
            Switch need = switches.get(0);
            // 总开关  0：开启 /1：关闭
            Integer totalOpen = need.getTotalOpen();
            if (totalOpen != null && totalOpen == 1) {
                totalFlag = false;
            }
            // 有害气体开关  0：开启 /1：关闭
            Integer sosOpen = need.getSosOpen();
            if (sosOpen != null && sosOpen == 1 || !totalFlag) {
                sosFlag = false;
            }
            // 邮箱开关  0：开启 /1：关闭
            Integer mailOpen = need.getMailOpen();
            if (mailOpen != null && mailOpen == 1 || !totalFlag) {
                mailFlag = false;
            }
            // 短信开关  0：开启 /1：关闭
            Integer smsOpen = need.getSmsOpen();
            if (smsOpen != null && smsOpen == 1 || !totalFlag) {
                smsFlag = false;
            }
            // 语音开关  0：开启 /1：关闭
            Integer phoneOpen = need.getPhoneOpen();
            if (phoneOpen != null && phoneOpen == 1 || !totalFlag) {
                phoneFlag = false;
            }
        }
        booleanList.add(sosFlag);
        booleanList.add(mailFlag);
        booleanList.add(smsFlag);
        booleanList.add(phoneFlag);
        return booleanList;
    }

    @Override
    public List<Boolean> checkSwitchByTemperature(Switch record) {
        List<Switch> switches = switchMapper.findByAll(record);
        boolean totalFlag = true;
        boolean temperatureFlag = true;
        boolean mailFlag = true;
        boolean smsFlag = true;
        boolean phoneFlag = true;
        List<Boolean> booleanList = new ArrayList<>();
        if (CollectionUtils.isNotEmpty(switches)) {
            Switch need = switches.get(0);
            // 总开关  0：开启 /1：关闭
            Integer totalOpen = need.getTotalOpen();
            if (totalOpen != null && totalOpen == 1) {
                totalFlag = false;
            }
            // 有害气体开关  0：开启 /1：关闭
            Integer temperatureOpen = need.getTemperatureOpen();
            if (temperatureOpen != null && temperatureOpen == 1 || !totalFlag) {
                temperatureFlag = false;
            }
            // 邮箱开关  0：开启 /1：关闭
            Integer mailOpen = need.getMailOpen();
            if (mailOpen != null && mailOpen == 1 || !totalFlag) {
                mailFlag = false;
            }
            // 短信开关  0：开启 /1：关闭
            Integer smsOpen = need.getSmsOpen();
            if (smsOpen != null && smsOpen == 1 || !totalFlag) {
                smsFlag = false;
            }
            // 语音开关  0：开启 /1：关闭
            Integer phoneOpen = need.getPhoneOpen();
            if (phoneOpen != null && phoneOpen == 1 || !totalFlag) {
                phoneFlag = false;
            }
        }
        booleanList.add(temperatureFlag);
        booleanList.add(mailFlag);
        booleanList.add(smsFlag);
        booleanList.add(phoneFlag);
        return booleanList;
    }

    @Override
    public List<Boolean> checkSwitchByElevation(Switch record) {
        List<Switch> switches = switchMapper.findByAll(record);
        boolean totalFlag = true;
        boolean elevationFlag = true;
        boolean mailFlag = true;
        boolean smsFlag = true;
        boolean phoneFlag = true;
        List<Boolean> booleanList = new ArrayList<>();
        if (CollectionUtils.isNotEmpty(switches)) {
            Switch need = switches.get(0);
            // 总开关  0：开启 /1：关闭
            Integer totalOpen = need.getTotalOpen();
            if (totalOpen != null && totalOpen == 1) {
                totalFlag = false;
            }
            // 有害气体开关  0：开启 /1：关闭
            Integer elevationOpen = need.getElevationOpen();
            if (elevationOpen != null && elevationOpen == 1 || !totalFlag) {
                elevationFlag = false;
            }
            // 邮箱开关  0：开启 /1：关闭
            Integer mailOpen = need.getMailOpen();
            if (mailOpen != null && mailOpen == 1 || !totalFlag) {
                mailFlag = false;
            }
            // 短信开关  0：开启 /1：关闭
            Integer smsOpen = need.getSmsOpen();
            if (smsOpen != null && smsOpen == 1 || !totalFlag) {
                smsFlag = false;
            }
            // 语音开关  0：开启 /1：关闭
            Integer phoneOpen = need.getPhoneOpen();
            if (phoneOpen != null && phoneOpen == 1 || !totalFlag) {
                phoneFlag = false;
            }
        }
        booleanList.add(elevationFlag);
        booleanList.add(mailFlag);
        booleanList.add(smsFlag);
        booleanList.add(phoneFlag);
        return booleanList;
    }

    @Override
    public List<Switch> findByAll(Switch record) {
        return switchMapper.findByAll(record);
    }

    @Override
    public int updateBatchSelective(List<Switch> list) {
        return switchMapper.updateBatchSelective(list);
    }
}




